package org.csmzxy.class2333;


class Book{
    String bookname;
    String autor;
    float price;
    Book(String bookname,String autor,float price){
        this.bookname =bookname;
        this.autor=autor;
        this.price=price;
        System.out.println("三个属性的全参构造方法");
    }
    Book(){}

    public String getBookname() {
        return bookname;
    }

    public String getAutor() {
        return autor;
    }

    public float getPrice() {
        return price;
    }

}
class novel extends Book{
    String type;

    public novel(String bookname, String autor, float price, String type) {
        super(bookname, autor, price);
        this.type = type;
    }


    @Override
    public String toString() {
        return "novel{" +
                "bookname='" + bookname + '\'' +
                ", autor='" + autor + '\'' +
                ", price=" + price +
                ", type='" + type + '\'' +
                '}';
    }
}
class textbook extends Book{
    String type;

    public textbook(String bookname, String autor, float price, String type) {
        super(bookname, autor, price);
        this.type = type;
    }

    @Override
    public String toString() {
        return "textbook{" +
                "bookname='" + bookname + '\'' +
                ", autor='" + autor + '\'' +
                ", price=" + price +
                ", type='" + type + '\'' +
                '}';
    }

    @Override
    public float  getPrice() {
        return super.getPrice()*0.8f;
    }
}
class magizine extends Book{
    String no;
    String bank;

    public magizine(String bookname, String autor, float price, String no, String bank) {
        super(bookname, autor, price);
        this.no = no;
        this.bank = bank;
    }

    @Override
    public String toString() {
        return "magizine{" +
                "bookname='" + bookname + '\'' +
                ", autor='" + autor + '\'' +
                ", price=" + price +
                ", no='" + no + '\'' +
                ", bank='" + bank + '\'' +
                '}';
    }

    @Override
    public float getPrice() {
        return super.getPrice()*0.75f;
    }
}
public class bookstore {
    public static void main(String[]args){
        Book[] book =new Book[3];

        novel novel =new novel("名人传","我",22.3f,"神传");
        book[0]=novel;

        for (int i=0;i<book.length;i++){
            System.out.println(book[i]);
        }
    }
}
